using System.Web.Mvc;
using Azure.Domain.Models;
using Azure.Domain.Services;
using Azure.Web.Models;

namespace Azure.Web.Controllers
{
    public abstract class BaseController : Controller
    {
        private readonly IBlogConfiguration _blogConfiguration;

        protected BaseController(IBlogConfiguration blogConfiguration)
        {
            _blogConfiguration = blogConfiguration;
        }

        public SiteConfiguration Configuration
        {
            get
            {
                return _blogConfiguration.Configuration;
            }
        } 

        protected override ViewResult View(string viewName, string masterName, object model)
        {
            ViewResult result = base.View(viewName, masterName, model);

            result.ViewData[Data.Site] = _blogConfiguration.Configuration;

            return result;
        }
    }
}